/*
 * @Description: vip规则卡片
 * @Author: iamsmiling
 * @Date: 2021-06-12 09:46:42
 * @LastEditTime: 2021-06-14 17:51:28
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/local/vip/vip_entity.dart';
import 'package:flutter/material.dart';

class VipRuleCard extends StatelessWidget {
  const VipRuleCard({Key? key}) : super(key: key);

  static List<VipPrivilegeEntity> rules = [
    VipPrivilegeEntity(label: "合租信息发布", v1: "限制2条", v2: "无限制"),
    VipPrivilegeEntity(label: "联系方式获取", v1: "每日免费1次", v2: "每日免费3次"),
    VipPrivilegeEntity(label: "信息免费刷新", v1: "每日免费1次", v2: "每日免费3次"),
    VipPrivilegeEntity(label: "券自动使用", v1: "无权限", v2: "可设置自动使"),
    VipPrivilegeEntity(label: "信息自由留言", v1: "限常用语", v2: "每日限次"),
    VipPrivilegeEntity(label: "道具商城购买", v1: "单张无优惠", v2: "全场8折优惠"),
    VipPrivilegeEntity(label: "发布优先审核", enable1: false, enable2: true),
    VipPrivilegeEntity(label: "搜索展示靠前", enable1: false, enable2: true),
    VipPrivilegeEntity(label: "VIP专属卡包", enable1: false, enable2: true),
    VipPrivilegeEntity(label: "大厅信息变色", enable1: false, enable2: false),
  ];
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Container(
            margin: EdgeInsets.only(bottom: R.dimen.dp28),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset(R.image.vipWave),
                Container(
                  margin: EdgeInsets.symmetric(horizontal: R.dimen.dp20),
                  child: Text(
                    "特权说明",
                    style: TextStyle(
                        fontSize: R.dimen.sp17,
                        fontWeight: FontWeight.w600,
                        color: R.color.ffbe7e0d),
                  ),
                ),
                Image.asset(R.image.vipWave)
              ],
            ),
          ),
          Container(
            margin: EdgeInsets.only(bottom: R.dimen.dp30),
            decoration: BoxDecoration(
                border: Border.all(width: R.dimen.dp2, color: R.color.fff0c06c),
                borderRadius: BorderRadius.circular(R.dimen.sp5)),
            child: Column(
              children: [
                DefaultTextStyle(
                  style: TextStyle(
                      fontSize: R.dimen.sp15,
                      color: R.color.ff111111,
                      fontWeight: FontWeight.w600),
                  child: Container(
                    color: R.color.fffde7c1,
                    padding: EdgeInsets.symmetric(vertical: R.dimen.dp15),
                    child: Row(
                      children: [
                        Expanded(
                            child: Text(
                          "项目",
                          textAlign: TextAlign.center,
                        )),
                        Expanded(
                            child: Text(
                          "普通会员",
                          textAlign: TextAlign.center,
                        )),
                        Expanded(
                            child: Text(
                          "VIP月卡",
                          textAlign: TextAlign.center,
                        ))
                      ],
                    ),
                  ),
                ),
                DefaultTextStyle(
                    style: TextStyle(
                        color: R.color.ff333333, fontSize: R.dimen.sp12),
                    child: Column(
                      children: [
                        for (VipPrivilegeEntity r in rules)
                          Container(
                            color: rules.indexOf(r).isOdd
                                ? R.color.fffde7c1
                                : R.color.fffcf2de,
                            height: R.dimen.dp38,
                            child: Row(
                              children: [
                                Expanded(
                                  child: Text(
                                    r.label,
                                    textAlign: TextAlign.center,
                                  ),
                                ),
                                Expanded(
                                  child: r.v1.isNotEmpty
                                      ? Text(
                                          r.v1,
                                          textAlign: TextAlign.center,
                                        )
                                      : Image.asset(
                                          r.enable1 ? R.image.yes : R.image.no),
                                ),
                                Expanded(
                                  child: r.v2.isNotEmpty
                                      ? Text(
                                          r.v2,
                                          textAlign: TextAlign.center,
                                        )
                                      : Image.asset(
                                          r.enable2 ? R.image.yes : R.image.no),
                                )
                              ],
                            ),
                          )
                      ],
                    ))
              ],
            ),
          ),
        ],
      ),
    );
  }
}
